<?php

namespace Viettrans\FrontBundle\Services;

class MyBreadCrumbGenerator {
    private $myBreadCrumb = array();

    public function addItem($label = '', $link = "") {
        if ($label == '') return $this;
		
		$this->myBreadCrumb[] = array('label'=>$label, 'link'=>$link);
        
        return $this;
    }
    
    public function generate() {
        $items = array();
        foreach($this->myBreadCrumb as $item) {
            if ($item['link'] != "") {
                $items[] = '<a href="'.$item['link'].'">'.$item['label'].'</a>';
            } else {
                $items[] = $item['label'];
            }
        }
        
        return $items;
    }
}